<?php

###########################################################################
#   Copyright (C) 2012 CDNPAL LTD by Christopher Gu                       #
#   resources@cdnpal.com                                                  #
#                                                                         #
#   coded for Php 4.3/5.X and above                                       #
#   and AllowOverride all for .htaccess                                   #
#                                                                         #
#   This program is free software released                                #
#   under the GPL version 2 license:                                      #
#   http://www.gnu.org/licenses/gpl-2.0.htm                               #
#                                                                         #
#   This program is distributed WITHOUT ANY WARRANTY                      #
#   or FITNESS FOR A PARTICULAR PURPOSE.                                  #
#                                                                         #
#   DADF-SDK                                                              #
#                                                                         #
###########################################################################

class OutgoingRequestFilter extends GenericDataObject
{
	
	protected $_primary = 'OutgoingRequestFilterID';
	protected $_name = 'OutgoingRequestFilter';
	
	public $class_member_only_outgoing_request_filter_geo_country_list;
	
	public $class_member_only_outgoing_request_filter_geo_state_list;
	
	public $class_member_only_outgoing_request_filter_language_list;
	
	public function add_outgoing_request_filter_geo_country($outgoing_request_filter_geo_country) {
		
		$this->class_member_only_outgoing_request_filter_geo_country_list[] = $outgoing_request_filter_geo_country;
	}
	
	public function add_outgoing_request_filter_geo_state($request_filter_geo_state) {
	
		$this->class_member_only_outgoing_request_filter_geo_state_list[] = $outgoing_request_filter_geo_state;
	}
	
	public function add_outgoing_request_filter_language($outgoing_request_filter_language) {
	
		$this->class_member_only_outgoing_request_filter_language_list[] = $outgoing_request_filter_language;
	}
	
	public function load_children() {
	
		$outgoing_request_filter_geo_country_factory = OutgoingRequestFilterGeoCountryFactory::get_instance();
	
		$params = array();
		$params["OutgoingRequestFilterID"] = $this->OutgoingRequestFilterID;
		$this->class_member_only_outgoing_request_filter_geo_country_list = $outgoing_request_filter_geo_country_factory->get($params);
		
		$outgoing_request_filter_geo_state_factory = OutgoingRequestFilterGeoStateFactory::get_instance();
		
		$this->class_member_only_outgoing_request_filter_geo_state_list = $outgoing_request_filter_geo_state_factory->get($params);
		
		
		$outgoing_request_filter_language_factory = OutgoingRequestFilterLanguageFactory::get_instance();
		
		$this->class_member_only_outgoing_request_filter_language_list = $outgoing_request_filter_language_factory->get($params);
	
	}
	
	public function save_children() {
	
		foreach ($this->class_member_only_outgoing_request_geo_country_list as $outgoing_request_geo_country):
	
			$outgoing_request_geo_country->save();
			$outgoing_request_geo_country->save_children();

		endforeach;
	
		foreach ($this->class_member_only_outgoing_request_geo_state_list as $outgoing_request_geo_state):
	
			$outgoing_request_geo_state->save();
			$outgoing_request_geo_state->save_children();
			
		endforeach;
	
		foreach ($this->class_member_only_outgoing_request_language_list as $outgoing_request_language):
			
			$outgoing_request_language->save();
			$outgoing_request_language->save_children();
		
		endforeach;
	
	}
	
}

